package de.hmm.hwip.security.service;

import android.util.Log;

/**
 * Exception wrapper class. It is used to catch all crypto exceptions 
 * 
 * @author Johannes Mendel
 * @version 05.11.2012
 */
public class CryptoException extends Exception 
{
	

	/**
	 * Serial ID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Classidentifier
	 */
	final String TAG = "CryptoException";
	/**
	 * Creating a new exception with a message and a cause.
	 * 
	 * @param message - message to set
	 * @param nestedException - causing exception
	 */
	public CryptoException(String message, Exception nestedException)
	{
		super(message, nestedException);
		Log.w(TAG, "message: " + message + " Exception: " + nestedException);
	}
	
	/**
	 * Creating a string from the exception.
	 */
	@Override
	public String toString()
	{
		return this.getMessage() + "\n" + this.getCause().getLocalizedMessage();
	}
}
